<template>
	<view class="search-container" :style="{'background-color': bgcolor}" @click="searchBoxHandle">
    <!-- 使用 vue 组件模拟 input 输入框的样式 -->
		<view class="search-box" :style="{'border-radius': radius + 'px'}">
		  <uni-icons type="search" size="17"></uni-icons>
      <text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search",
    props: {
      // 背景颜色
      bgcolor: {
         type: String,
         default: '#C00000'
      },
      // 圆角尺寸
      radius: {
        type: Number,
        // 单位 px
        default: 18
      }
    },
		data() {
			return {
				
			};
		},
    methods:{
      searchBoxHandle() {
        this.$emit('click')
      }
    }
	}
</script>

<style lang="scss">
.search-container {
  display: flex;
  padding: 0 10px;
  height: 50px;
  align-items: center;
  .search-box {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #FFFFFF;
    width: 100%;
    height: 36px;
    text {
      font-size: 15px;
      margin-left: 5px;
    }
  }
}
</style>
